package com.hllxd.hism.star.basic.service.model.order;

import lombok.Data;

import java.util.List;

/**
 * lixiyong 2020.11.04
 */
@Data public class OrderDeliverEntity {

//    @JSONField(name = "ID")
    public Long ID;

    public String deliverID;// '配送单ID'
    public Long transOrderID; // 'TFZ订单ID'
    public String purchaserName;// 订单甲方: 采购商名称

    public Integer outType;//出库方式： 库存直发
    public Integer paymentType; // 快递费结算方式 哗啦啦月结

    public String receiverName; // 收货人名
    public String receiverMobile; //收货手机
    public String receiverAddress; // 收货地址, 所在省， 所在市， 所在区， 详细地址

    public Integer  provinceId;
    public String  provinceName;
    //城市
    public Integer cityId;
    public String  cityName;
    //区域
    public Integer areaId;
    public String  areaName;
    //收货人详细地址}
    public String  addressDetail;

    public List<OrderProductDetailEntity> productList;
    public String productDetailList; // 出库产品list （产品ID, 产品名称， 签约总量， 已出库数， 库存量， 本次出库数）

    public Integer isTest; // 是否测试 0:正常 1:测试
    private Integer action; //tinyint(4) NOT NULL DEFAULT '0' COMMENT '记录状态',
    private Long actionTime; //bigint(20) NOT NULL DEFAULT '0' COMMENT '记录修改时间',
    private Long createTime; //bigint(20) NOT NULL DEFAULT '0' COMMENT '记录创建时间',

    public String status;


    // 初始化默认加载
    public static OrderDeliverEntity build(OrderMasterEntity orderMaster,
        List<OrderProductDetailEntity> productList, MallOrderMasterEntity mallOrder) {
        OrderDeliverEntity thiz = new OrderDeliverEntity();

        thiz.transOrderID = orderMaster.transOrderID;
        thiz.purchaserName = orderMaster.transOrderTitle;
        //        thiz.collectionState = p.collectionState;
        thiz.receiverMobile = mallOrder.receiverMobile;
        thiz.receiverName = mallOrder.receiverName;
        thiz.receiverAddress = mallOrder.receiverAddress;



        thiz.productList = productList;
        thiz.isTest = orderMaster.testOrder;
//        thiz.productDetailList = JSON.toJSONString(productList);
        return thiz;
    }
}
